home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2004 March / PCWMAR04.iso / Software / Trial / TestTrack Pro 6 / ttprowininstall.exe / %LSMAINDIR% / LicenseServer Help / wwhelp / wwhimpl / js / scripts / tabs.js < prev   
Encoding:
JavaScript  |  2003-12-12  |  3.6 KB  |  121 lines

  1. // Copyright (c) 2000-2001 Quadralay Corporation.  All rights reserved.
  2. //
  3.  
  4. function  WWHTabs_Object()
  5. {
  6.   this.mWidth = null;
  7.  
  8.   this.fInit       = WWHTabs_Init;
  9.   this.fDisplayTab = WWHTabs_DisplayTab;
  10.   this.fHeadHTML   = WWHTabs_HeadHTML;
  11.   this.fBodyHTML   = WWHTabs_BodyHTML;
  12. }
  13.  
  14. function  WWHTabs_Init()
  15. {
  16.   var  InitialTab = -1;
  17.  
  18.  
  19.   // Select first visible tab
  20.   //
  21.   if (WWHFrame.WWHJavaScript.mPanels.mPanelEntries.length > 0)
  22.   {
  23.     InitialTab = 0;
  24.  
  25.     // Calculate width based on number of displayed tabs
  26.     //
  27.     this.mWidth = "" + 100/WWHFrame.WWHJavaScript.mPanels.mPanelEntries.length + "%";
  28.   }
  29.  
  30.   return InitialTab;
  31. }
  32.  
  33. function  WWHTabs_DisplayTab()
  34. {
  35.   WWHFrame.WWHNavigationFrame.WWHTabsFrame.location.replace(WWHFrame.WWHHelp.mHelpURLPrefix + "wwhelp/wwhimpl/js/html/tabs.htm");
  36. }
  37.  
  38. function  WWHTabs_HeadHTML()
  39. {
  40.   var  StylesHTML = "";
  41.  
  42.  
  43.   // Generate style section
  44.   //
  45.   StylesHTML += "<style type=\"text/css\">\n";
  46.   StylesHTML += " <!--\n";
  47.   StylesHTML += "  a  { text-decoration: none ;\n";
  48.   StylesHTML += "       color: " + WWHFrame.WWHJavaScript.mSettings.mTabs.mDefaultTabTextColor + " }\n";
  49.   StylesHTML += "  th { color: " + WWHFrame.WWHJavaScript.mSettings.mTabs.mSelectedTabTextColor + " ;\n";
  50.   StylesHTML += "       " + WWHFrame.WWHJavaScript.mSettings.mTabs.mFontStyle + " }\n";
  51.   StylesHTML += "  td { color: " + WWHFrame.WWHJavaScript.mSettings.mTabs.mDefaultTabTextColor + " ;\n";
  52.   StylesHTML += "       " + WWHFrame.WWHJavaScript.mSettings.mTabs.mFontStyle + " }\n";
  53.   StylesHTML += " -->\n";
  54.   StylesHTML += "</style>\n";
  55.  
  56.   return StylesHTML;
  57. }
  58.  
  59. function  WWHTabs_BodyHTML()
  60. {
  61.   var  TabsHTML = "";
  62.   var  Height = 21;
  63.   var  MaxIndex;
  64.   var  Index;
  65.   var  CellType;
  66.   var  BorderColor;
  67.   var  BackgoundColor;
  68.   var  WrapPrefix;
  69.   var  WrapSuffix;
  70.   var  OnClick;
  71.  
  72.  
  73.   // Setup table for tab display
  74.   //
  75.   TabsHTML += "<table border=0 cellspacing=2 cellpadding=0 width=\"100%\">\n";
  76.   TabsHTML += "<tr>\n";
  77.  
  78.   for (MaxIndex = WWHFrame.WWHJavaScript.mPanels.mPanelEntries.length, Index = 0 ; Index < MaxIndex ; Index++)
  79.   {
  80.     // Display anchor only if not selected
  81.     //
  82.     if (Index == WWHFrame.WWHJavaScript.mCurrentTab)
  83.     {
  84.       CellType = "th";
  85.       BorderColor = WWHFrame.WWHJavaScript.mSettings.mTabs.mSelectedTabBorderColor;
  86.       BackgroundColor = WWHFrame.WWHJavaScript.mSettings.mTabs.mSelectedTabColor;
  87.       WrapPrefix = "<b>";
  88.       WrapSuffix = "</b>";
  89.       OnClick = "";
  90.     }
  91.     else
  92.     {
  93.       CellType = "td";
  94.       BorderColor = WWHFrame.WWHJavaScript.mSettings.mTabs.mDefaultTabBorderColor;
  95.       BackgroundColor = WWHFrame.WWHJavaScript.mSettings.mTabs.mDefaultTabColor;
  96.       WrapPrefix = "<b><a href=\"javascript:WWHFrame.WWHJavaScript.fStartChangeTab(" + Index + ");\">";
  97.       WrapSuffix = "</a></b>";
  98.       OnClick = " onClick=\"WWHFrame.WWHJavaScript.fStartChangeTabWithDelay(" + Index + ");\"";
  99.     }
  100.  
  101.     TabsHTML += "<td width=\"" + this.mWidth + "\" bgcolor=\"" + BorderColor + "\">";
  102.     TabsHTML += "<table border=0 cellspacing=1 cellpadding=0 width=\"100%\">";
  103.     TabsHTML += "<tr>";
  104.  
  105.     TabsHTML += "<" + CellType + " nowrap align=center height=" + Height + " width=\"" + this.mWidth + "\" bgcolor=\"" + BackgroundColor + "\"" + OnClick + ">";
  106.     TabsHTML += WrapPrefix;
  107.     TabsHTML += WWHFrame.WWHJavaScript.mPanels.mPanelEntries[Index].mPanelObject.mPanelTabTitle;
  108.     TabsHTML += WrapSuffix;
  109.     TabsHTML += "</" + CellType + ">";
  110.  
  111.     TabsHTML += "</tr>";
  112.     TabsHTML += "</table>";
  113.     TabsHTML += "</td>\n";
  114.   }
  115.  
  116.   TabsHTML += "</tr>\n";
  117.   TabsHTML += "</table>\n";
  118.  
  119.   return TabsHTML;
  120. }
  121.